<template>
	<div class="u-page">
		<u-navbar :title="title" :background="background" :border-bottom="false"></u-navbar>
		<div class="section">
			<div class="u-pt-15 u-pb-10 u-page-color">
			   	<u-swiper :list="Ads" height="250" border-radius="0" @click="clickSwiper"></u-swiper>
			</div>
			<div class="u-pt-10 u-pl-10 u-pr-10 u-page-color-other">
				<div class="partner-box partner-item" :key="index" v-for="(item, index) in EvaluatorsList" @click="toPartnerInfo(item)">
					<div class="u-flex u-row-between u-col-center u-mb-5 u-pt-10">
						<u-avatar :src="item.AvatarUrl" size="100" mode="square"></u-avatar>
						<div class="u-col-center u-flex-1 u-pl-10">
							<div class="u-title">
								{{item.NickName}}<span class="u-pl-5"><u-icon :name="hotURL" size="35" v-for="(aItem,aIndex) in parseInt(item.hotLevel)" :key="aIndex"></u-icon></span>
							</div>
							<div class="u-scroll-x" style="width: 500rpx;">
								<u-tag
									v-for="(tagItem,tagIndex) in item.IdentityJob.split(',')"
									:key="tagIndex"
									:text="tagItem"
									type="info"
									mode="dark"
									size="mini"
									bg-color="#f7f5f8"
								></u-tag>
								<u-tag
									v-for="(tagItem,tagIndex) in item.Labels.split(',')"
									:key="tagIndex"
									:text="tagItem"
									type="info"
									mode="dark"
									size="mini"
									bg-color="#f7f5f8"
								></u-tag>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
    export default {
      data() {
        return {
			Ads: [],
			pageNum: 1,
			pageSize: 10,
			swab: '',
			EvaluatorsList: [],
			title: '工作者',
			background: {
				backgroundImage: 'linear-gradient(to right , rgb(244,227,233), rgb(246,230,236))'
			},
		};
      },
      
      onLoad(options) {
		  this.getAds()
		  this.getEvaluatorsListData()
	  },
	  
	  onShow() {
	  },
    
	  onPullDownRefresh() {
		this.pageNum = 1
		this.getEvaluatorsListData()
	  	setTimeout(() => {
	  		// 停止Loading
	  		uni.stopPullDownRefresh();
	  	}, 1000)
	  },
	  
	  onReachBottom() {
			this.pageNum += 1
			this.getEvaluatorsListData()
	  },
    
      methods: {
		  
		  /**
		  * 获取广告图
		  */
		  async getAds() {
		  	let result = await this.$u.api.unifyMiniRest({
		  		systemid: "meily",
		  		url: "/config/list",
		  		configType: "workers"
		  	});
		  	if(result.code == 200){
		  		let rows = result.rows
		  		if(rows.length > 0){
		  			for(const i in rows){
		  				if(rows[i].configKey == 'workers-top'){
		  					let obj = {image: rows[i].imageLink.split(",")[0],link: rows[i].configLink,source: rows[i].configFrom}
		  					this.Ads.push(obj)
		  				}
		  			}
		  		}
		  	}
		  },
		  
		  /**
		   * 点击轮播图跳转
		   */
		  clickSwiper(index){
		  	this.routeAD(this.Ads[index].link,this.Ads[index].source)
		  },
			
			/**
			 * 获取更多测评师列表数据
			 */
			async getEvaluatorsListData() {
				let result = await this.$u.api.unifyMiniRest({
					systemid: "meily",
					url: "/minrest",
					appid: 'meily',
					wf_num: 'R_meily_BL003',
					pageNum: this.pageNum,
					pageSize: this.pageSize,
					swab: this.swab,
					loading: true // 默认发起请求会有一个全局的Loading，设置false可去掉
				});
				if(result.code == '200'){
					if(this.pageNum1 == 1){
						this.EvaluatorsList = result.data
					}else{
						this.EvaluatorsList = this.EvaluatorsList.concat(result.data)
					}
					this.swab = result.swab
				}
			},
			
	  },
    };
</script>

<style scoped>
	/* *****************更多拍档start**************** */
	.box {
	  width: 100%;
	  position: relative;
	  /* background-color: #ffffff; */
	  padding-bottom: 20rpx;
	}
	
	li {
	  padding-top: 5rpx;
	}
	
	.topbar {
	  font-size: 30rpx;
	  font-weight: bold;
	  height: 80rpx;
	  line-height: 80rpx;
	  border-bottom: 1rpx #e5e5e5 solid;
	  padding-left: 30rpx;
	  padding-right: 30rpx;
	  background-color: white;
	}
	
	.slot-content {
	  font-size: 28rpx;
	  color: $u-content-color;
	  padding-left: 30rpx;
	  padding-bottom: 30rpx;
		text-align: center;
	}
	
	.notice-title {
	  width: 580rpx;
	  height: 40rpx;
	  text-overflow: -o-ellipsis-lastline;
	  overflow: hidden;
	  text-overflow: ellipsis;
	  display: -webkit-box;
	  -webkit-line-clamp: 1;
	  line-clamp: 1;
	  -webkit-box-orient: vertical;
	}
	
	.job-name {
	  width: 350rpx;
	  height: 50rpx;
	  text-overflow: -o-ellipsis-lastline;
	  overflow: hidden;
	  text-overflow: ellipsis;
	  display: -webkit-box;
	  -webkit-line-clamp: 1;
	  line-clamp: 1;
	  -webkit-box-orient: vertical;
	}
	
	.notificationUL li {
		  margin-bottom: 25rpx;
	}
	
	.u-mode-dark-primary.data-v-1481d46d {
	  background-color: #8e9094;
	  color: #FFFFFF;
	}
	
	/* 查看按钮 */
	.see{
	  height: 50rpx;
	  font-size: 25rpx;
	}
	
	.content {
	  width: 620rpx;
	  height: 120rpx;
	  text-overflow: -o-ellipsis-lastline;
	  overflow: hidden;
	  text-overflow: ellipsis;
	  display: -webkit-box;
	  -webkit-line-clamp: 3;
	  line-clamp: 3;
	  -webkit-box-orient: vertical;
	}
	
	.nickName {
	  width: 150rpx;
	  text-overflow: -o-ellipsis-lastline;
	  overflow: hidden;
	  text-overflow: ellipsis;
	  display: -webkit-box;
	  -webkit-line-clamp: 1;
	  line-clamp: 1;
	  -webkit-box-orient: vertical;
	}
	
	.change-batch {
		text-align: right;
	  padding-right: 10rpx;
	  background-color: #fff;
	  padding-top: 23rpx;
	  color: #007eff;
	}
	
	.job-name {
		width: 360rpx;
	  height: 40rpx;
	  text-overflow: -o-ellipsis-lastline;
	  overflow: hidden;
	  text-overflow: ellipsis;
	  display: -webkit-box;
	  -webkit-line-clamp: 1;
	  line-clamp: 1;
	  -webkit-box-orient: vertical;
	}
	
	.top-content {
		padding-bottom: 15rpx;
	  background-color: #fff;
		justify-content: space-between;
	}
	
	.build-team {
		text-align: left;
	  padding-left: 5%;
		padding-right: 5%;
	  background-color: #fff;
	  padding-top: 20rpx;
	}
	
	.title-big {
		font-size: 33rpx;
	  font-weight: 600;
	  padding-bottom: 10rpx;
	  padding-left: 10rpx;
	}
	
	.partner-item {
		margin-bottom: 10rpx !important;
	  border-radius: 20rpx;
	  width: 95%;
	  margin: 0 auto;
	}
	
	.u-scroll-x {
	  text-align: left !important;
	}
	
	.partner-more{
		  display: flex;
		  justify-content: space-between;
	}
	/* ****************更多拍档end***************** */
</style>